//315
class Solution {
    public List<Integer> countSmaller(int[] nums) {
        int len = nums.length;
        int[] index = new int[len];
        List<Integer> counts = new ArrayList<>();
        for (int i = 0; i < len; i++) {
            index[i] = i;
            counts.add(0);
        }
        
        if (len == 1) {
            return counts;
        }
        guibingSort(counts, index, nums, 0, len-1);
        return counts;
    }

    public void guibingSort(List<Integer> counts, int[] index, int[] nums, int l, int r) {
        if (l >= r) {
            return;
        }
        int mid = (l+r)/2;
        guibingSort(counts, index, nums, l, mid);
        guibingSort(counts, index, nums, mid+1, r);
        sort(counts, index, nums, l, mid+1, r);
    }
//从大到小
    public void sort(List<Integer> counts, int[] index, int[] nums, int l, int m, int r) {
        int[] arr = new int[r-l+1];
        int[] in = new int[r-l+1];
        int a1 = l;
        int a2 = m;
        int i = 0;
        while (a2 <= r && a1 < m) {
            if (nums[a1] > nums[a2]) {
                in[i] = index[a1];
                arr[i++] = nums[a1++];
                counts.set(index[a1-1], counts.get(index[a1-1])+r-a2+1);
            }
            else {
                in[i] = index[a2];
                arr[i++] = nums[a2++];
            }
        }
        while (a2 <= r) {
            in[i] = index[a2];
            arr[i++] = nums[a2++];
        }
        while (a1 < m) {
            in[i] = index[a1];
            arr[i++] = nums[a1++];
        }
        for (i = 0; i < arr.length; i++) {
            index[l] = in[i];
            nums[l++] = arr[i];
        }
    }   
}

在父类Base中定义了计算方法calculate()，该方法用于计算两个数的乘积（X*Y）。请在子类Sub中重写该方法，将计算逻辑由乘法改为除法（X/Y）。注意，当分母为0时输出“Error”。
输入描述：
两个整数
输出描述：
两个整数的商(int类型，不考虑小数情况)

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextInt()) {
            int x = scanner.nextInt();
            int y = scanner.nextInt();
            Sub sub = new Sub(x, y);
            sub.calculate();
        }
    }

}

class Base {

    private int x;
    private int y;

    public Base(int x, int y) {
        this.x = x;
        this.y = y;
    }

    public int getX() {
        return x;
    }

    public int getY() {
        return y;
    }

    public void calculate() {
        System.out.println(getX() * getY());
    }

}

class Sub extends Base {

    //write your code here.....
    Sub(int x, int y){
        super(x,y);
    }
    public void calculate() {
        if (getY() == 0){
            System.out.println("Error");
        }
        else{
            System.out.println(getX() / getY());
        }
    }

}
//62

class Solution {
    public int uniquePaths(int m, int n) {
        int dp[][] = new int[m+1][n+1];
        dp[1][0] = 1;
        for (int i = 1; i <= m; i++) {
            for (int j = 1; j <= n; j++) {
                dp[i][j] = dp[i-1][j] + dp[i][j-1];
            }
        }
        return dp[m][n];
    }
}


